-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[miele] Clean up properties and improve reliability and performance #11423
[miele] Clean up properties and improve reliability and performance #11423
Conversation
… of relying on property. Fixes openhab#11422 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
…rom auto-discovered things). Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
…ay, although this is a quite rare scenario. Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
@kgoderis, @kaikreuzer - would it be possible for you to review this PR? It would be nice if it could be included in next milestone as it fixes an issue with dependency to protocol and seriaNumber properties which really would be nice to solve sooner than later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks @jlaur for this nice refactoring and for cleaning up so many places in the code along the way!
Looks all good to me, so let's merge!
…penhab#11423) * Use appliance cache for getting full UID with protocol prefix instead of relying on property. * Set bare protocol name as property. * Fix potential null pointer access warnings. * Remove unused import. * Renamed property protocol to protocolAdapter for correctness. * Add connectionType property. * Add appliance model property. * Remove useless properties brandId and companyId always having value MI. * Rename property dc to deviceClass and set it consistently (not only from auto-discovered things). * Added constants for remaining handlers with hardcoded device classes. * Fix SCA: AuthorContributionDescriptionCheck * Fix SCA: ModifierOrderCheck * Rename ExtendedDeviceStateUtil to be a bit more generic. * Extract device class string parsing to utility method. * Fix SCA: ForbiddenPackageUsageCheck * Fix redundant null check. * Fix potential null pointer access warnings. * Fix unsafe null type conversion (type annotations) * Share same configuration (UID) for all appliance types. * Refer to gateway instead of ZigBee network in configuration. * Remove dependency to seriaNumber property for multicast channel updates. * Simplified filtering of irrelevant device class. * Remove devices from remoteUid cache also when disappearing from gateway, although this is a quite rare scenario. * Add default i18n properties file. * Add partial Danish translation. Fixes openhab#11422 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Dave J Schoepel <dave@theschoepels.com>
…penhab#11423) * Use appliance cache for getting full UID with protocol prefix instead of relying on property. * Set bare protocol name as property. * Fix potential null pointer access warnings. * Remove unused import. * Renamed property protocol to protocolAdapter for correctness. * Add connectionType property. * Add appliance model property. * Remove useless properties brandId and companyId always having value MI. * Rename property dc to deviceClass and set it consistently (not only from auto-discovered things). * Added constants for remaining handlers with hardcoded device classes. * Fix SCA: AuthorContributionDescriptionCheck * Fix SCA: ModifierOrderCheck * Rename ExtendedDeviceStateUtil to be a bit more generic. * Extract device class string parsing to utility method. * Fix SCA: ForbiddenPackageUsageCheck * Fix redundant null check. * Fix potential null pointer access warnings. * Fix unsafe null type conversion (type annotations) * Share same configuration (UID) for all appliance types. * Refer to gateway instead of ZigBee network in configuration. * Remove dependency to seriaNumber property for multicast channel updates. * Simplified filtering of irrelevant device class. * Remove devices from remoteUid cache also when disappearing from gateway, although this is a quite rare scenario. * Add default i18n properties file. * Add partial Danish translation. Fixes openhab#11422 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
…penhab#11423) * Use appliance cache for getting full UID with protocol prefix instead of relying on property. * Set bare protocol name as property. * Fix potential null pointer access warnings. * Remove unused import. * Renamed property protocol to protocolAdapter for correctness. * Add connectionType property. * Add appliance model property. * Remove useless properties brandId and companyId always having value MI. * Rename property dc to deviceClass and set it consistently (not only from auto-discovered things). * Added constants for remaining handlers with hardcoded device classes. * Fix SCA: AuthorContributionDescriptionCheck * Fix SCA: ModifierOrderCheck * Rename ExtendedDeviceStateUtil to be a bit more generic. * Extract device class string parsing to utility method. * Fix SCA: ForbiddenPackageUsageCheck * Fix redundant null check. * Fix potential null pointer access warnings. * Fix unsafe null type conversion (type annotations) * Share same configuration (UID) for all appliance types. * Refer to gateway instead of ZigBee network in configuration. * Remove dependency to seriaNumber property for multicast channel updates. * Simplified filtering of irrelevant device class. * Remove devices from remoteUid cache also when disappearing from gateway, although this is a quite rare scenario. * Add default i18n properties file. * Add partial Danish translation. Fixes openhab#11422 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Nick Waterton <n.waterton@outlook.com>
…penhab#11423) * Use appliance cache for getting full UID with protocol prefix instead of relying on property. * Set bare protocol name as property. * Fix potential null pointer access warnings. * Remove unused import. * Renamed property protocol to protocolAdapter for correctness. * Add connectionType property. * Add appliance model property. * Remove useless properties brandId and companyId always having value MI. * Rename property dc to deviceClass and set it consistently (not only from auto-discovered things). * Added constants for remaining handlers with hardcoded device classes. * Fix SCA: AuthorContributionDescriptionCheck * Fix SCA: ModifierOrderCheck * Rename ExtendedDeviceStateUtil to be a bit more generic. * Extract device class string parsing to utility method. * Fix SCA: ForbiddenPackageUsageCheck * Fix redundant null check. * Fix potential null pointer access warnings. * Fix unsafe null type conversion (type annotations) * Share same configuration (UID) for all appliance types. * Refer to gateway instead of ZigBee network in configuration. * Remove dependency to seriaNumber property for multicast channel updates. * Simplified filtering of irrelevant device class. * Remove devices from remoteUid cache also when disappearing from gateway, although this is a quite rare scenario. * Add default i18n properties file. * Add partial Danish translation. Fixes openhab#11422 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
…penhab#11423) * Use appliance cache for getting full UID with protocol prefix instead of relying on property. * Set bare protocol name as property. * Fix potential null pointer access warnings. * Remove unused import. * Renamed property protocol to protocolAdapter for correctness. * Add connectionType property. * Add appliance model property. * Remove useless properties brandId and companyId always having value MI. * Rename property dc to deviceClass and set it consistently (not only from auto-discovered things). * Added constants for remaining handlers with hardcoded device classes. * Fix SCA: AuthorContributionDescriptionCheck * Fix SCA: ModifierOrderCheck * Rename ExtendedDeviceStateUtil to be a bit more generic. * Extract device class string parsing to utility method. * Fix SCA: ForbiddenPackageUsageCheck * Fix redundant null check. * Fix potential null pointer access warnings. * Fix unsafe null type conversion (type annotations) * Share same configuration (UID) for all appliance types. * Refer to gateway instead of ZigBee network in configuration. * Remove dependency to seriaNumber property for multicast channel updates. * Simplified filtering of irrelevant device class. * Remove devices from remoteUid cache also when disappearing from gateway, although this is a quite rare scenario. * Add default i18n properties file. * Add partial Danish translation. Fixes openhab#11422 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
…penhab#11423) * Use appliance cache for getting full UID with protocol prefix instead of relying on property. * Set bare protocol name as property. * Fix potential null pointer access warnings. * Remove unused import. * Renamed property protocol to protocolAdapter for correctness. * Add connectionType property. * Add appliance model property. * Remove useless properties brandId and companyId always having value MI. * Rename property dc to deviceClass and set it consistently (not only from auto-discovered things). * Added constants for remaining handlers with hardcoded device classes. * Fix SCA: AuthorContributionDescriptionCheck * Fix SCA: ModifierOrderCheck * Rename ExtendedDeviceStateUtil to be a bit more generic. * Extract device class string parsing to utility method. * Fix SCA: ForbiddenPackageUsageCheck * Fix redundant null check. * Fix potential null pointer access warnings. * Fix unsafe null type conversion (type annotations) * Share same configuration (UID) for all appliance types. * Refer to gateway instead of ZigBee network in configuration. * Remove dependency to seriaNumber property for multicast channel updates. * Simplified filtering of irrelevant device class. * Remove devices from remoteUid cache also when disappearing from gateway, although this is a quite rare scenario. * Add default i18n properties file. * Add partial Danish translation. Fixes openhab#11422 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
…penhab#11423) * Use appliance cache for getting full UID with protocol prefix instead of relying on property. * Set bare protocol name as property. * Fix potential null pointer access warnings. * Remove unused import. * Renamed property protocol to protocolAdapter for correctness. * Add connectionType property. * Add appliance model property. * Remove useless properties brandId and companyId always having value MI. * Rename property dc to deviceClass and set it consistently (not only from auto-discovered things). * Added constants for remaining handlers with hardcoded device classes. * Fix SCA: AuthorContributionDescriptionCheck * Fix SCA: ModifierOrderCheck * Rename ExtendedDeviceStateUtil to be a bit more generic. * Extract device class string parsing to utility method. * Fix SCA: ForbiddenPackageUsageCheck * Fix redundant null check. * Fix potential null pointer access warnings. * Fix unsafe null type conversion (type annotations) * Share same configuration (UID) for all appliance types. * Refer to gateway instead of ZigBee network in configuration. * Remove dependency to seriaNumber property for multicast channel updates. * Simplified filtering of irrelevant device class. * Remove devices from remoteUid cache also when disappearing from gateway, although this is a quite rare scenario. * Add default i18n properties file. * Add partial Danish translation. Fixes openhab#11422 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Fixes #11422
Signed-off-by: Jacob Laursen jacob-github@vindvejr.dk
Reliability
#11244 introduced a dependency to the protocol property for correctly handling both ZigBee and Wi-Fi appliances. This had two drawbacks:
Similarly a dependency to the serialNumber property was introduced for correct handling multicast updates.
To fix both problems, two internal appliance caches are now used for fast lookup of UID from appliance id (i.e. "0123456789#0" -> "hdm:ZigBee:0123456789#0") as well as from remote UID/serial number. After removing this property dependency, the protocol property has been renamed to protocolAdapter which now contains only the actual protocol adapter name, i.e. ZigBee or LAN. Additionally, a new property, connectionType, has been introduced. For Wi-Fi devices protocolAdapter is LAN and connectionType is WiFi.
Performance
Appliance cache has been changed from List to HashMap for faster lookups, and is also being used more actively now for looking up UID's.
Property cleanup
Properties removed:
Properties renamed:
Properties added:
Before:
![image](https://user-images.githubusercontent.com/19519842/138553171-ed64c350-247a-4b56-b891-ca199efd431f.png)
After:
![image](https://user-images.githubusercontent.com/19519842/138553202-6d12a9f3-1c5a-4204-abe7-f5d17455d3d7.png)
Refactoring
Refer to "gateway" instead of "ZigBee network" in configuration, since both ZigBee and LAN/Wi-Fi appliances are supported by the gateway.
Added constants for remaining handlers with hardcoded device classes.
Changed obscure string operations for skipping this result of the getDeviceClassObjects response:
"DeviceClass": "com.prosyst.mbs.services.zigbee.hdm.deviceclasses.ReportingControl"
while processing only this result:
"DeviceClass": "com.miele.xgw3000.gateway.hdm.deviceclasses.MieleWashingMachine"
(or other device class name for appliance)
Fixed all warnings:
Fixed some Static Code Analysis issues:
Translation
Added default i18n properties file and partial Danish translation as baseline. Next steps will be adding custom strings for states, programs and phases so these can be provided in desired language. This is not planned within the context of this PR.